﻿
using System.IO;
namespace Rosieks.Web.Flow
{
    public abstract class LosFormatterBase
    {
        /// <summary>
        /// Transforms the view-state value contained in a System.IO.Stream object to
        /// a limited object serialization (LOS)-formatted object.
        /// </summary>
        /// <param name="stream">A System.IO.Stream that contains the view-state value to transform.</param>
        /// <returns>A LOS-formatted object.</returns>
        public abstract object Deserialize(Stream stream);

        /// <summary>
        /// Transforms the specified view-state value to a limited object serialization
        /// (LOS)-formatted object.
        /// </summary>
        /// <param name="input">The view-state value to transform.</param>
        /// <returns>A LOS-formatted object.</returns>
        /// <exception cref="System.Web.HttpException">The view state is invalid.</exception>
        public abstract object Deserialize(string input);

        /// <summary>
        /// Transforms the view-state value contained in a System.IO.TextReader object
        /// to a limited object serialization (LOS)-formatted object.
        /// </summary>
        /// <param name="input">A System.IO.TextReader that contains the view-state value to transform.</param>
        /// <returns>A LOS-formatted object.</returns>
        public abstract object Deserialize(TextReader input);

        /// <summary>
        /// Transforms a limited object serialization (LOS)-formatted object into a view-state
        /// value and places the results into a System.IO.Stream object.
        /// </summary>
        /// <param name="stream">The System.IO.Stream to receive the transformed value.</param>
        /// <param name="value">The LOS-formatted object to transform into a view-state value.</param>
        public abstract void Serialize(Stream stream, object value);

        /// <summary>
        /// Transforms a limited object serialization (LOS)-formatted object into a view-state
        ///     value and places the results into a System.IO.TextWriter object.
        /// </summary>
        /// <param name="output">The System.IO.TextWriter to receive the transformed value.</param>
        /// <param name="value">The LOS-formatted object to transform into a view-state value.</param>
        public abstract void Serialize(TextWriter output, object value);
    }
}
